# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Peter Cai <peter at typeblog dot net>

pkgname=gtop
pkgver=1.1.3
pkgrel=1
pkgdesc='System monitoring dashboard for terminal'
arch=('any')
url='https://github.com/aksakalli/gtop'
license=('MIT')
depends=('nodejs')
makedepends=('npm')
source=("$pkgname-$pkgver.tar.gz::https://github.com/aksakalli/gtop/archive/v${pkgver}.tar.gz")
sha512sums=('6cf57406bdfe387aaa743d872e0b6d1aa23dfbaecee3cf53cd33fa351c2de1ea414630ee888c0aa5e0491b972b4dd5572125c8eb736a8bff695f44334052bb1f')

build() {
  cd $pkgname-$pkgver
  npm install --production
}

package() {
  local _npmdir="$pkgdir/usr/lib/node_modules"
  mkdir -p "$_npmdir"/gtop
  cp -R $pkgname-$pkgver/* "$_npmdir/gtop"
  local _bindir="$pkgdir/usr/bin"
  mkdir -p "$_bindir"
  ln -s /usr/lib/node_modules/gtop/bin/gtop "$_bindir/gtop"

  install -Dm644 $pkgname-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
